﻿using SD.Infrastructure.RepositoryBase;
using SlamDunk.MES.Domain.Entities.StockContext;
using SlamDunk.ValueObjects.Enums;
using System;
using System.Collections.Generic;

namespace SlamDunk.MES.Domain.IRepositories.Interfaces.StockContext
{
    /// <summary>
    /// 物料批次仓储接口
    /// </summary>
    public interface IMaterialLotRepository : IAggRootRepository<MaterialLot>
    {
        #region # 分页获取物料批次列表 —— ICollection<MaterialLot> FindByPage(string keywords...
        /// <summary>
        /// 分页获取物料批次列表
        /// </summary>
        /// <param name="keywords">关键字</param>
        /// <param name="materialId">物料定义Id</param>
        /// <param name="supplierId">供应商Id</param>
        /// <param name="startProducedDate">生产日期开始</param>
        /// <param name="endProducedDate">生产日期结束</param>
        /// <param name="startExpiredDate">过期日期开始</param>
        /// <param name="endExpiredDate">过期日期结束</param>
        /// <param name="startReceptionDate">接收日期开始</param>
        /// <param name="endReceptionDate">接收日期结束</param>
        /// <param name="materialSourceType">物料来源类型</param>
        /// <param name="facilityIds">工厂模型Id集</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">页容量</param>
        /// <param name="rowCount">总记录数</param>
        /// <param name="pageCount">总页数</param>
        /// <returns>物料批次列表</returns>
        ICollection<MaterialLot> FindByPage(string keywords, Guid? materialId, Guid? supplierId, DateTime? startProducedDate, DateTime? endProducedDate, DateTime? startExpiredDate, DateTime? endExpiredDate, DateTime? startReceptionDate, DateTime? endReceptionDate,
            MaterialSourceType? materialSourceType, IList<Guid> facilityIds, int pageIndex, int pageSize, out int rowCount, out int pageCount);
        #endregion

        #region # 获取物料批次 —— MaterialLot SingleOrDefault(Guid materialId, Guid supplierId...
        /// <summary>
        /// 获取物料批次
        /// </summary>
        /// <param name="materialId">物料定义Id</param>
        /// <param name="supplierId">供应商Id</param>
        /// <param name="productionBatchNo">生产批号</param>
        /// <param name="producedDate">生产日期</param>
        /// <param name="guaranteePeriod">保质期</param>
        /// <param name="expiredDate">过期日期</param>
        /// <param name="receptionDate">接收日期</param>
        /// <param name="specification">规格</param>
        /// <returns>物料批次</returns>
        MaterialLot SingleOrDefault(Guid materialId, Guid supplierId, string productionBatchNo, DateTime producedDate, TimeSpan guaranteePeriod, DateTime expiredDate, DateTime receptionDate, string specification);
        #endregion

        #region # 是否存在物料批次 —— bool Exists(Guid materialId, Guid supplierId...
        /// <summary>
        /// 是否存在物料批次
        /// </summary>
        /// <param name="materialId">物料定义Id</param>
        /// <param name="supplierId">供应商Id</param>
        /// <param name="productionBatchNo">生产批号</param>
        /// <param name="producedDate">生产日期</param>
        /// <param name="guaranteePeriod">保质期</param>
        /// <param name="expiredDate">过期日期</param>
        /// <param name="receptionDate">接收日期</param>
        /// <param name="specification">规格</param>
        /// <returns>是否存在</returns>
        bool Exists(Guid materialId, Guid supplierId, string productionBatchNo, DateTime producedDate, TimeSpan guaranteePeriod, DateTime expiredDate, DateTime receptionDate, string specification);
        #endregion
    }
}
